package application.translators.impl;

import application.model.MaterialModel;
import application.model.MaterialsModel;
import application.translators.Translator;
import mappings.Material;

import java.util.List;

public class MaterialsTranslator implements Translator<List<Material>, MaterialsModel>
{

    @Override
    public MaterialsModel translate(List<Material> input)
    {
        MaterialsModel materialsModel = new MaterialsModel();

        for(Material material : input)
        {
            MaterialModel materialModel = new MaterialModel();

            materialModel.setId(material.getId());
            materialModel.setName(material.getName());

            materialsModel.addMaterial(materialModel);
        }

        return materialsModel;
    }
}
